import axios from 'axios'
export const getConfig = () =>
	axios.get('/api/config').then(r => {
		// 兼容 {success:true, data:{...}} 或直接返回对象
		if (r.data && typeof r.data === 'object') {
			if ('data' in r.data && typeof r.data.data === 'object') return r.data.data
			return r.data
		}
		return {}
	})
export const saveConfig = (c) => axios.post('/api/config', c)
export const getQrcode = () => axios.get('/api/bili/qrcode', { responseType: 'blob' })
